/*************************************************
Author: byron
Date: 13/09/2013
Description:
Notes: 
*************************************************/

#ifndef __CFightEndData_h__
#define __CFightEndData_h__

#include "commclass.h"
#include "../battle/CBattleData.h"
#include "CTArray.h"

class CFightEndUnit
{
public:
    CFightEndUnit()
    {
        Clear();
    }

    void Clear()
    {
        _bIsLife = true;
        _iWinNum = 0;
        _uiGID = 0;
    }

    virtual ~CFightEndUnit()
    {
    }

    unsigned int GetGID() const {return _uiGID;}
    bool IsLife() const {return _bIsLife;}
    int GetWinNum() const {return _iWinNum;}

    void SetGID(unsigned int uiVal) {_uiGID = uiVal;}
    void SetLife(bool bVal) {_bIsLife = bVal;}
    void AddWinNum() {++_iWinNum;}

private:
    bool _bIsLife;
    int _iWinNum;
    unsigned int _uiGID;
};

class CFightEndData
{
public:
    CFightEndData()
    {
        Clear();
    }

    void Clear()
    {
        _astRoleList.m_iUsedCount = _astRoleList.GetCount();
        for (int i = 0; i < _astRoleList.Size(); ++i)
        {
            _astRoleList[i].Clear();
        }

        _astLeftTeam.m_iUsedCount = _astLeftTeam.GetCount();
        for (int i = 0; i < _astLeftTeam.Size(); ++i)
        {
            _astLeftTeam[i].Clear();
        }

        _astRightTeam.m_iUsedCount = _astRightTeam.GetCount();
        for (int i = 0; i < _astRightTeam.Size(); ++i)
        {
            _astRightTeam[i].Clear();
        }
    }

    virtual ~CFightEndData()
    {
    }

    int GetRoleSize() const {return _astRoleList.Size();}
    CFightEndUnit& GetRoleUnit(int iIndex) {return _astRoleList[iIndex];}

    int GetLeftTeamSize() const {return _astLeftTeam.Size();}
    CBattleRoleList& GetLeftTeam(int iIndex) {return _astLeftTeam[iIndex];}

    int GetRightTeamSize() const {return _astRightTeam.Size();}
    CBattleRoleList& GetRightTeam(int iIndex) {return _astRightTeam[iIndex];}

private:
    CTLib::CTArray<CFightEndUnit, MAX_FIGHT_END_ROLE_TOTAL> _astRoleList;
    CTLib::CTArray<CBattleRoleList, MAX_FIGHT_END_ROLE_SIDE> _astLeftTeam;
    CTLib::CTArray<CBattleRoleList, MAX_FIGHT_END_ROLE_SIDE> _astRightTeam;
};

#endif //__CFightEndData_h__

